<html>
<head>
    <script>
    function runTest() {
        if (window.testRunner)
            testRunner.dumpAsText();
            
        var htmlDoc = document.implementation.createHTMLDocument('');
        
        htmlDoc.open();
        htmlDoc.write('<html><img id="theImage" src="/test"></html>');

        var path = htmlDoc.getElementById('theImage').src;

        if (path == 'file:///test')
            document.getElementById('result').innerHTML = 'SUCCESS';
        else if (/^file:\/\/\/[C-Z]:\/test$/.test(path))  // MS Windows.
            document.getElementById('result').innerHTML = 'SUCCESS';
    }
    </script>
</head>
<body onload="runTest()">
    This tests that paths in documents created using document.implementation.createHTMLDocument are returned correctly.
    <div id="result">FAILURE</div>
</body>
</html>
